home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 2001 May / SGI IRIX Base Documentation 2001 May.iso / usr / share / catman / p_man / cat3c / syslog.z / syslog
Encoding:
Text File  |  2001-04-17  |  8.3 KB  |  199 lines

  1.  
  2.  
  3.  
  4. SSSSYYYYSSSSLLLLOOOOGGGG((((3333CCCC))))                                                          SSSSYYYYSSSSLLLLOOOOGGGG((((3333CCCC))))
  5.  
  6.  
  7.  
  8. NNNNAAAAMMMMEEEE
  9.      syslog, openlog, closelog, setlogmask, vsyslog - control system log
  10.  
  11. SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  12.      ####iiiinnnncccclllluuuuddddeeee <<<<ssssyyyysssslllloooogggg....hhhh>>>>
  13.  
  14.      vvvvooooiiiidddd ooooppppeeeennnnlllloooogggg((((ccccoooonnnnsssstttt cccchhhhaaaarrrr ****iiiiddddeeeennnntttt,,,, iiiinnnntttt llllooooggggoooopppptttt,,,, iiiinnnntttt ffffaaaacccciiiilllliiiittttyyyy))));;;;
  15.  
  16.      vvvvooooiiiidddd ssssyyyysssslllloooogggg((((iiiinnnntttt pppprrrriiiioooorrrriiiittttyyyy,,,, ccccoooonnnnsssstttt cccchhhhaaaarrrr ****mmmmeeeessssssssaaaaggggeeee,,,, _p_a_r_a_m_e_t_e_r_s...))));;;;
  17.  
  18.      vvvvooooiiiidddd cccclllloooosssseeeelllloooogggg((((vvvvooooiiiidddd))));;;;
  19.  
  20.      iiiinnnntttt sssseeeettttllllooooggggmmmmaaaasssskkkk((((iiiinnnntttt mmmmaaaasssskkkkpppprrrriiii))));;;;
  21.  
  22.      vvvvooooiiiidddd vvvvssssyyyysssslllloooogggg((((iiiinnnntttt pppprrrriiiioooorrrriiiittttyyyy,,,, ccccoooonnnnsssstttt cccchhhhaaaarrrr ****mmmmeeeessssssssaaaaggggeeee,,,, vvvvaaaa____lllliiiisssstttt aaaapppp))));;;;
  23.  
  24. DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  25.      _S_y_s_l_o_g arranges to write _m_e_s_s_a_g_e onto the system log maintained by
  26.      _s_y_s_l_o_g_d(1M).  The message is tagged with _p_r_i_o_r_i_t_y.  The message looks
  27.      like a _p_r_i_n_t_f(3S) string except that %%%%mmmm is replaced by the current error
  28.      message (collected from _e_r_r_n_o).  A trailing newline is added if needed.
  29.      This message will be read by _s_y_s_l_o_g_d(1M) and written to the system
  30.      console, log files, or forwarded to _s_y_s_l_o_g_d on another host as
  31.      appropriate.  _V_s_y_s_l_o_g is like _s_y_s_l_o_g except that instead of being called
  32.      with a variable number of arguments, it is called with an argument list
  33.      as defined by _s_t_d_a_r_g(5).
  34.  
  35.      Priorities are encoded as a _f_a_c_i_l_i_t_y and a _l_e_v_e_l.  The facility describes
  36.      the part of the system generating the message.  The level is selected
  37.      from an ordered list:
  38.  
  39.      LOG_EMERG     A panic condition.  This is normally broadcast to all
  40.                    users.
  41.  
  42.      LOG_ALERT     A condition that should be corrected immediately, such as a
  43.                    corrupted system database.
  44.  
  45.      LOG_CRIT      Critical conditions, e.g., hard device errors.
  46.  
  47.      LOG_ERR       Errors.
  48.  
  49.      LOG_WARNING   Warning messages.
  50.  
  51.      LOG_NOTICE    Conditions that are not error conditions, but should
  52.                    possibly be handled specially.
  53.  
  54.      LOG_INFO      Informational messages.
  55.  
  56.      LOG_DEBUG     Messages that contain information normally of use only when
  57.                    debugging a program.
  58.  
  59.  
  60.  
  61.  
  62.  
  63.                                                                         PPPPaaaaggggeeee 1111
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. SSSSYYYYSSSSLLLLOOOOGGGG((((3333CCCC))))                                                          SSSSYYYYSSSSLLLLOOOOGGGG((((3333CCCC))))
  71.  
  72.  
  73.  
  74.      If _s_y_s_l_o_g cannot pass the message to _s_y_s_l_o_g_d, it will attempt to write
  75.      the message on /_d_e_v/_c_o_n_s_o_l_e if the LOG_CONS option is set (see below).
  76.  
  77.      If special processing is needed, _o_p_e_n_l_o_g can be called to initialize the
  78.      log file.  The parameter _i_d_e_n_t is a string that is prepended to every
  79.      message.  _L_o_g_o_p_t is a bit field indicating logging options.
  80.  
  81.      Current values for _l_o_g_o_p_t are:
  82.  
  83.      LOG_PID       log the process id with each message:  useful for
  84.                    identifying instantiations of daemons.
  85.  
  86.      LOG_CONS      Force writing messages to the console if unable to send it
  87.                    to _s_y_s_l_o_g_d. This option is safe to use in daemon processes
  88.                    that have no controlling terminal since _s_y_s_l_o_g will fork
  89.                    before opening the console.
  90.  
  91.      LOG_ODELAY    Delay opening the connection to _s_y_s_l_o_g_d until the first
  92.                    _s_y_s_l_o_g call. This is the default.
  93.  
  94.      LOG_NDELAY    Open the connection to _s_y_s_l_o_g_d immediately.  Useful for
  95.                    programs that need to manage the order in which file
  96.                    descriptors are allocated.
  97.  
  98.      LOG_NOWAIT    Don't wait for children forked to log messages on the
  99.                    console.  This option should be used by processes that
  100.                    enable notification of child termination via SIGCHLD, as
  101.                    _s_y_s_l_o_g may otherwise block waiting for a child whose exit
  102.                    status has already been collected.
  103.  
  104.      LOG_PERROR    Write messages to stderr as well as to _s_y_s_l_o_g_d.
  105.  
  106.      The _f_a_c_i_l_i_t_y parameter encodes a default facility to be assigned to all
  107.      messages that do not have an explicit facility encoded:
  108.  
  109.      LOG_KERN      Messages generated by the kernel.  These cannot be
  110.                    generated by any user processes.
  111.  
  112.      LOG_USER      Messages generated by random user processes.  This is the
  113.                    default facility identifier if none is specified.
  114.  
  115.      LOG_MAIL      The mail system.
  116.  
  117.      LOG_DAEMON    System daemons, such as _r_o_u_t_e_d(1M), _f_t_p_d(1M), _r_s_h_d(1M),
  118.                    etc.
  119.  
  120.      LOG_AUTH      The authorization system:  _l_o_g_i_n(1), _s_u(1M), _g_e_t_t_y(1M),
  121.                    etc.  _f_t_p_d(1M), and _r_s_h_d(1M) also use LOG_AUTH.
  122.  
  123.      LOG_LPR       The line printer spooling system:  _l_p_r(1), _l_p_d(1M), etc.
  124.  
  125.  
  126.  
  127.  
  128.  
  129.                                                                         PPPPaaaaggggeeee 2222
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136. SSSSYYYYSSSSLLLLOOOOGGGG((((3333CCCC))))                                                          SSSSYYYYSSSSLLLLOOOOGGGG((((3333CCCC))))
  137.  
  138.  
  139.  
  140.      LOG_NEWS      The network news system.
  141.  
  142.      LOG_UUCP      The UNIX-to-UNIX Copy system:  _u_u_c_p(1C), _u_u_c_i_c_o(1M),
  143.                    _u_u_x(1C), etc.
  144.  
  145.      LOG_LOCAL0    Reserved for local use.  Similarly for LOG_LOCAL1 through
  146.                    LOG_LOCAL7.
  147.  
  148.      _C_l_o_s_e_l_o_g can be used to close the log file.
  149.  
  150.      _S_e_t_l_o_g_m_a_s_k sets the log priority mask to _m_a_s_k_p_r_i and returns the previous
  151.      mask.  Calls to _s_y_s_l_o_g with a priority not set in _m_a_s_k_p_r_i are rejected.
  152.      The mask for an individual priority _p_r_i is calculated by the macro
  153.      LOG_MASK(_p_r_i); the mask for all priorities up to and including _t_o_p_p_r_i is
  154.      given by the macro LOG_UPTO(_t_o_p_p_r_i).  The default allows all priorities
  155.      to be logged.
  156.  
  157.  
  158. CCCCAAAAVVVVEEEEAAAATTTTSSSS
  159.      A call to _o_p_e_n_l_o_g does not make a copy of the _i_d_e_n_t parameter, it merely
  160.      stores a pointer to it.  This means that the caller cannot re-use the
  161.      memory in which the string is stored.
  162.  
  163. EEEEXXXXAAAAMMMMPPPPLLLLEEEESSSS
  164.      syslog(LOG_ALERT, "who: internal error 23");
  165.  
  166.      openlog("ftpd", LOG_PID, LOG_DAEMON);
  167.      setlogmask(LOG_UPTO(LOG_ERR));
  168.      syslog(LOG_INFO, "Connection from host %d", CallingHost);
  169.  
  170.      syslog(LOG_INFO|LOG_LOCAL2, "foobar error: %m");
  171.  
  172. SSSSEEEEEEEE AAAALLLLSSSSOOOO
  173.      syslogd(1M)
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.                                                                         PPPPaaaaggggeeee 3333
  196.  
  197.  
  198.  
  199.